package OLD;

import com.sun.lwuit.Form;
import com.sun.lwuit.events.ActionListener;
import java.io.IOException;
import util.GoogleMaps;
import util.locationService;

/**
 *
 * @author nialldeasy
 */
public class Map extends Menu {

    double lat = 100, lon = 10;
    int zoom = 6;
    locationService myLoc = new locationService(false);
    GoogleMaps map = new GoogleMaps();

    public Map(ActionListener a)
    {
        super("Map", "backround.png",a);
            setTransitionType(1);
            setBackCommand("Itinerary");
            myLoc.start();

    }
    public void updatePosition(Form f){
        double LAT=myLoc.latitude,LON=myLoc.longitude;

        if(LAT!=lat||LON!=lon){
            try {
                lat=LAT;
                lon=LON;
                f.setBgImage(map.retrieveStaticImage(200, 320, lat, lat, zoom, "png32"));
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
    public void update(Form f) {
       updatePosition(f);
       f.repaint();

       // lat = M.myLocation.latitude;
       // lon = M.myLocation.longitude;
  
    }



}
